package com.goldplusgold.tradedelay.app.my.account;

import android.content.Context;
import android.content.Intent;

import com.example.account.manager.AppCacheSharedPreferences;
import com.example.account.manager.ParmasKey;
import com.goldplusgold.tradedelay.app.application.TDApplication;
import com.goldplusgold.tradedelay.app.my.activity.UserActivity;

/**
 * Created by Administrator on 2017/7/19.
 */

public class Accountmanager {


    public static void Login(Context context , String mUserName , String mPassword , AccountCallBack<UserInfo> callBack){

        AccountNet accountNet = new AccountNet(context , callBack);
        accountNet.login_net(mUserName ,mPassword);

    }

   /* public static void AutoLogin(Context context , AccountCallBack<UserInfo> callBack){
        AccountNet accountNet = new AccountNet(context , callBack);
        accountNet.login_net(AppCacheSharedPreferences.getCacheString(ParmasKey.user_name) ,
                AppCacheSharedPreferences.getCacheString(ParmasKey.user_password));
    }*/

    //判断曾经登录过
    public static boolean OnceLogin(){
        String str = AppCacheSharedPreferences.getCacheString(ParmasKey.user_name) ;
        if( str != null && !("").equals(str)){
            return true;
        }else{
            return false;
        }
    }

    public static void startLogin() {
        Intent intent = new Intent(TDApplication.getApplication(), UserActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        TDApplication.getApplication().startActivity(intent);
    }

}
